import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.regex.*;

public class FindProjFolder 
{
	public void findObjByName(String gdfFile) throws IOException
	{
		FileInputStream fstream = new FileInputStream(gdfFile);
		DataInputStream inStream = new DataInputStream(fstream);
		BufferedReader inBuffer = new BufferedReader(new InputStreamReader(inStream));
	  
		String line = null;
		//bypass the node-def header
	  	line = inBuffer.readLine();
	  	
  		Pattern p = Pattern.compile(".*surfaceflinger.*", Pattern.CASE_INSENSITIVE);
  		
  		Matcher m = p.matcher("PackageManager_");
  		
  		System.out.println(m.matches());
		
	  	while((line = inBuffer.readLine()) != null)
	  	{
	  		
	  		String words[] = line.split(",");
	  		
	  		//get out of the loop when going into the edge-def region
	  		if (words[0].equals("edgedef> node1"))
	  		{
	  			break;
	  		}
	  		
	  		if (Utilities.isOutObj(words[0].trim()) == true)
	  		{
	  			continue;
	  		}
	  		
	  		if (Utilities.isCtsbj(words[0].trim()) == true)
	  		{
	  			continue;
	  		}
	  	
	  		m.reset(words[0].trim().toLowerCase());
	  		if (m.matches() == true)
	  		{
	  			System.out.println(words[1]);
	  		}
	  	}
	  	
	  	inBuffer.close();
	}
	
	public static void main(String args[]) throws IOException
	{
		FindProjFolder fuyun = new FindProjFolder();
		fuyun.findObjByName("data/android-4.0.1/all.gdf");
	}

}
